home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 December / .net Magazine (FR) - Issue 02 - Dec 1996.iso / Utilpers / SUPERQUE / DATA.2 / FILTERS / PSINIT / ZSFONT1.PS < prev   
Text File  |  1995-11-15  |  2KB  |  54 lines

  1. %!PS-Adobe-3.0
  2. %%BeginFile: zsfont1.ps
  3. %
  4. %   Copyright (c) 1994, 1995 Zenographics, Inc., Irvine, CA. All rights reserved
  5. %
  6. %
  7. % Routines to create stubs for default built-in fonts. This is essentially
  8. % part of the zsfont.ps package, but it is separate from zsfont.ps because
  9. % zsfont.ps is run before a device is setup; the calls this module makes
  10. % require a device to be setup to enable the instructions which assume a
  11. % current device.
  12. %
  13. %
  14. % Create semi-prepared versions of the built-in Windows fonts for inclusion
  15. % in FontDirectory. The fonts are normal in all respects except that they
  16. % have a /PrivateStr (in /Private) containing a 'null' to save most of the
  17. % space that a font occupies. The font will create a real /PrivateStr on the
  18. % fly the first time that its BuildChar is executed.
  19. %
  20.     [    % List of resident fonts
  21.     /Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
  22.     /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
  23.     /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
  24.     /Symbol
  25.     ] 
  26.     {
  27.     % The general idea is to pre-allocate max-length strings for the 2 names
  28.     % + the weight of the font, so we can release the VM allocated for
  29.     % the PrivateStr that is allocated by getplatformfontmetrics; bracket
  30.     % getplatformfontmetrics with save/restore.
  31.     32 string                                            % Max TrueType sizes
  32.     32 string
  33.     64 string
  34.     save
  35.     5 -1 roll                                            %str str str save name
  36.     dup getplatformfontmetrics not
  37.         {stop}
  38.     if
  39.  
  40.     % On stack, get rid of PrivateStr, substitute pre-alloc'd strs for new ones.
  41.     3 -1 roll pop null 3 1 roll                    % get rid of PrivateStr
  42.     5 -1 roll 19 -1 roll copy 5 1 roll            % FullName
  43.     6 -1 roll 19 -1 roll copy 6 1 roll            % FamilyName
  44.     7 -1 roll 19 -1 roll copy 7 1 roll            % weight
  45.  
  46.     % Release VM alloc'd by getplatformfontmetrics
  47.     18 -1 roll restore
  48.  
  49.     % Create a font from modified platformfontmetrics
  50.     __buildfontfromplatformmetrics
  51.     definefont pop
  52.     }
  53. forall
  54.